<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function* foo() {
        yield 1;
        yield 2;
        yield 3;
        return;
    }

    for (let item of foo()) {
        console.log(item);
    }
    let fI = foo();
    let item = fI.next();
    while (!item.done){
        console.log(item.value);
        item = fI.next();
    }
</script>
</body>
</html>
